home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 121_01 / sh.doc < prev    next >
Text File  |  1985-08-19  |  7KB  |  200 lines

  1.  
  2.      SH (1)                    BDS C Users' Group                    SH (1)
  3.  
  4.  
  5.  
  6.      NAME        NAME 
  7.           sh - a 'little shell' command interpreter 
  8.  
  9.      SYNOPSIS        SYNOPSIS 
  10.           sh             sh 
  11.  
  12.      DESCRIPTION        DESCRIPTION 
  13.           The Little Shell is designed to cover the uglier part of 
  14.           CP/M with a somewhat more pleasant interface.  This is 
  15.           accomplished at a cost.  The shell is written in BDS C and 
  16.           is five times the size of the CP/M CCP.  Hence it takes 
  17.           somewhat longer to load into memory at warm boots.  Also, 
  18.           since the shell clobbers the CCP, submit does not work when 
  19.           the shell is invoked.  Nevertheless, the shell provides 
  20.           features not otherwise available to CP/M users.  
  21.  
  22.           CP/M offers no mechanism for chaining except for the kludgey 
  23.           and inconvenient submit mechanism.  The shell offers two 
  24.           more desirable techniques.  Multiple commands may be typed 
  25.           on a single command line as follows: 
  26.  
  27.                $ command [args...] ; command [args...] ; ...
  28.  
  29.           The commands are executed in sequential order from left to 
  30.           right as on Unix.  The amount of stuff on the command line 
  31.           is limited to the command buffer size which is defined in 
  32.           the CBIOS and in the shell source.  
  33.  
  34.           Alternatively, files of commands called Shell Scripts may be 
  35.           used.  These files contain multiple command lines to be 
  36.           executed.  The present version of the Shell limits the 
  37.           length of command files to the size of the command line 
  38.           buffer.  
  39.  
  40.           The CP/M operating environment does not lend itself to the 
  41.           use of frequently invoked commands in the form of executable 
  42.           files.  Consequently, the shell has an assortment of 
  43.           built-in commands.  The current list is as follows: 
  44.  
  45.                cat file file...     - print named files on console
  46.                ccp                  - invoke the CP/M command processor
  47.                cd disk              - select named CP/M disk
  48.                clr                  - clear the screen
  49.                echo [args...]       - echo command line arguments
  50.                exit                 - exit from the shell (warm boot)
  51.                lock file file...    - set named files to readonly
  52.                logout               - (also ^D) invoke a login program
  53.                ls disk              - list dir (default is current disk)
  54.                pwd                  - print current CP/M disk
  55.                ren file1 file2      - rename file1 to file2
  56.                rm file file...      - remove named files
  57.                sleep n              - suspend execution for n seconds
  58.                unlock file file...  - set named files to readwrite
  59.                #                    - comment (ignore command line)
  60.                ^\                   - quit, like exit for now
  61.  
  62.  
  63.  
  64.  
  65.                                       -1-
  66.  
  67.  
  68.      SH (1)                    BDS C Users' Group                    SH (1)
  69.  
  70.  
  71.      CAVEATS        CAVEATS 
  72.           This program has not been tested by the librarian, due to 
  73.           lack of time.  No bug reports have been received.  
  74.  
  75.      EXAMPLES        EXAMPLES 
  76.           A sample shell script follows: 
  77.  
  78.                c1 $1.c
  79.                l2 $1
  80.                if -r $1.crl rm $1.crl
  81.                if $2 == -o ren $1.com a.out
  82.                exit
  83.  
  84.           Command line argument substitutions occur exactly as on the 
  85.           V6 Unix shell.  
  86.  
  87.      SEE ALSO        SEE ALSO 
  88.           The Unix Programmers Manual Sixth Edition, 
  89.           Software Tools Programmers Manual, 
  90.           BD Software C Compiler Manual v1.50 
  91.  
  92.      BUGS        BUGS 
  93.           Shell Scripts must be limited to size of the Command line 
  94.           buffer.  Programs cannot return a status.  There are not yet 
  95.           any Shell Variables.  
  96.  
  97.      NOTES        NOTES 
  98.           The following hackers' guide was written by the author, 
  99.           Steve Blasingame.  
  100.  
  101.  
  102.           Getting the shell running...  
  103.  
  104.           (This thing runs only on CP/M 2.2) 
  105.  
  106.           First hack your CBIOS to include storage for the structure 
  107.           the shell calls iop.  The address in the CBIOS listing of 
  108.           this structure is the SHBUF define in the Shell source.  
  109.           This kluge allows us to save data for the shell between warm 
  110.           boots.  The structure of the buffer in the CBIOS is as 
  111.           follows: 
  112.  
  113.                bufsiz:     equ     1030     ;default in bdscio.h
  114.  
  115.                iop:
  116.                shdsk:      db      0
  117.                shsav:      dw      0
  118.                nocli:      db      0
  119.                shbuf:      ds      BUFSIZ
  120.  
  121.           The CBIOS MUST also be modified to check the entry 
  122.           iop->_nocli at warm boots and zero it at cold boots.  When 
  123.           this flag is low the CCP should be modified at the following 
  124.           addresses: 
  125.  
  126.                CCP+7 = 02h
  127.                CCP+8 = 'S'
  128.                CCP+9 = 'H'
  129.  
  130.  
  131.                                       -2-
  132.  
  133.  
  134.      SH (1)                    BDS C Users' Group                    SH (1)
  135.  
  136.  
  137.           This modification should occur AFTER the CCP has been loaded 
  138.           at warmboot.  To make matters more complicated, there are 
  139.           two entrypoints (undocumented) to the CCP.  One, CCP+0, 
  140.           checks the buffer we have just munged and if it contains a 
  141.           filename, runs the .com file of the same name.  Entrypoint 
  142.           two, CCP+3, zeros the buffer.  Hence, if we save a CP/M 
  143.           image with the buffer modified and our CBIOS uses the first 
  144.           entrypoint CP/M will attempt to run SH.COM at every bootup 
  145.           (I have taken advantage of this on my own system, you may 
  146.           wish to do the same).  Whichever method one uses to chain 
  147.           the shell, the CBIOS must check the iop->_nocli flag before 
  148.           warmboots and act on the CCP accordingly if the 
  149.           shell-builtin, CCP is to work.  
  150.  
  151.           If you are not an experienced CP/M hacker you should either 
  152.           get help in installing the shell or not attempt it at all.  
  153.           Likewise, if your CBIOS is not accessible at source level, 
  154.           forget it.  Be sure to send useful mods and repair jobs 
  155.           (there are certainly some bugs) to the librarian or to me 
  156.           directly.  
  157.  
  158.                Addresses:
  159.                USPS    Steve Blasingame
  160.                        4121 Hidden Hill
  161.                        Norman, OK 73069
  162.  
  163.                Usenet  duke!uok!bsteve
  164.  
  165.  
  166.           As a last resort you can call me at (405) 360-2336 after 
  167.           hours and BEFORE MIDNIGHT.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.                                       -3-
  198.  
  199. ystem, you may 
  200.           wish to do the sa